package com.usian.controller;

import com.usian.mapper.UserMapper;

import com.usian.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class UserController {
    @Autowired
    private UserMapper userMapper;
    @GetMapping("/findAll")
    public List<User> findAll(){
        List<User> list=userMapper.findAll();
        return list;
    }
    //根据id查询
    @GetMapping("findByid")
    public List<User> findByid(Integer id){
        List<User> byid=userMapper.findByid(id);
        return byid;
    }
    //根据姓名查询
    @GetMapping("/findByname")
    public List<User> findByid(String name){
        List<User> byname=userMapper.findByname(name);
        return byname;
    }

    
}
